<?php
/**
 * 视图
 */
Route::group('admin', function () {

    //首页
    Route::rule('', 'admin/view.index/index');
    //上传页面
    Route::rule('uploadImage', 'admin/view.upload/image');
    //仪表盘（主页）
    Route::rule('dashboard', 'admin/view.index/dashboard');
    //登录页
    Route::get('login', 'admin/view.public/login');
    //退出
    Route::get('logout', 'admin/view.public/logout');

    Route::group('menu', function () {
        //菜单列表
        Route::get('', 'admin/view.menu/index');
        //菜单添加
        Route::get('add', 'admin/view.menu/add');
        //菜单编辑
        Route::get('edit/:id', 'admin/view.menu/edit');
    });

    Route::group('user', function () {
        Route::get('', 'admin/view.user/index'); //用户管理
        Route::get('add', 'admin/view.user/addUser'); //新增用户
        Route::get('edit/:id', 'admin/view.user/editUser'); //编辑用户
        Route::group('admin', function () {
            Route::get('', 'admin/view.user/admins');
            Route::get('add', 'admin/view.user/addAdmin');
            Route::get('edit/:id', 'admin/view.user/editAdmin');
        });
    });
    //角色管理
    Route::group('group', function () {
        Route::get('', 'admin/view.group/index'); //角色列表
        Route::get('add', 'admin/view.group/add'); //角色列表
        Route::get('edit/:id', 'admin/view.group/edit');
    });
    //个人信息、密码修改
    Route::group('profile', function () {
        //信息修改
        Route::get('', 'admin/view.profile/index');
        //密码修改
        Route::get('changePwd', 'admin/view.profile/changePwd');
    });

    Route::get('options', 'admin/view.options/index');
    Route::get('language', 'admin/view.language/index');
    Route::group('language', function () {
        //语言新增
        Route::get('add', 'admin/view.language/add');
        //语言修改
        Route::get('edit/:id', 'admin/view.language/edit');
    });
    Route::group('platform', function () {
        //微信公众号管理
        Route::group('wechat', function () {
            Route::get('add', 'admin/view.platformWechat/add');
            Route::get('edit/:id', 'admin/view.platformWechat/edit');
            Route::get('', 'admin/view.platformWechat/index');
        });
    });
    Route::group('addons', function () {
        Route::get('', 'admin/view.addons/index');
        Route::get('options/:d_id', 'admin/view.addons/options');
    });
});
Route::group('api', function () {
    Route::group('admin', function () {
        //个人资料修改接口
        Route::group('profile', function () {
            //信息修改
            Route::put('', 'admin/profile/index');
            //密码修改
            Route::put('changePwd', 'admin/profile/changePwd');
        });
        //登录接口
        Route::post('login', 'admin/public/login');
        //菜单接口
        Route::group('menu', function () {
            //获取子菜单【当前登录用户有权限的】
            Route::get('child/:id', 'admin/menu/getChildList');
            //获取树状菜单
            Route::get('tree', 'admin/menu/getTreeList');
            //切换菜单状态
            Route::get('toggle/:id', 'admin/menu/toggle');
            //资源接口
            Route::resource('', 'admin/menu');
        });
        //配置
        Route::group('options', function () {
            Route::get('/clearCache', 'admin/options/clearCache');
            Route::post('/:type', 'admin/options/update');
            Route::get('/:type', 'admin/options/read');
            Route::get('', 'admin/options/index');
        });
        //语言管理
        Route::group('language', function () {
            Route::get('toggle/:id', 'admin/language/toggle');
            Route::resource('', 'admin/language');
        });
        //平台管理
        Route::group('platform', function () {
            //微信公众号管理
            Route::group('wechat', function () {
                Route::get('toggle/:id', 'admin/platformWechat/toggle');
                Route::resource('', 'admin/platformWechat');
            });
        });
        //权限组
        Route::group('group', function () {
            Route::get('toggle/:id', 'admin/group/toggleGroupStatus'); //权限组状态切换
            Route::get('getAuth/[:id]', 'admin/group/getAuth'); //获取权限组的权限列表
            Route::resource('', 'admin/group'); //权限组管理
        });
        //用户
        Route::group('user', function () {
            Route::group('admin', function () {
                Route::get(':id', 'admin/user/getAdminInfo');
                Route::put(':id', 'admin/user/updateAdmin');
                Route::post('', 'admin/user/addAdmin');
                Route::delete(':id', 'admin/user/delAdmin');
                Route::get('', 'admin/user/getAdmins');

            });
            Route::resource('', 'admin/user'); //用户管理
            Route::get('toggle/:id', 'admin/user/toggle');
            Route::get('search', 'admin/user/searchUser');
        });
        //统计
        Route::group('count', function () {
            Route::get('pv', 'admin/count/pv');
            Route::get('uv', 'admin/count/uv');
            Route::get('device', 'admin/count/device');
            Route::get('newUsers', 'admin/count/newUsers');
            Route::get('userGrowthRate', 'admin/count/userGrowthRate');
            Route::get('avgUseTime', 'admin/count/avgUseTime');
        });
        //文件组
        Route::group('upload', function () {
            Route::group('group', function () {
                Route::get('', 'admin/uploadGroup/index');
                Route::get(':id', 'admin/uploadGroup/read');
                Route::delete(':id', 'admin/uploadGroup/delete');
                Route::post(':id', 'admin/uploadGroup/update');
                Route::post('', 'admin/uploadGroup/save');
            });
            //文件管理
            Route::get('', 'admin/uploadFile/index');//获取文件列表
            Route::post('deletes', 'admin/uploadFile/deletes');//批量删除文件
            Route::post('move/:id', 'admin/uploadFile/move');//批量移动文件
        });
        //插件管理
        Route::group('addons', function () {
            Route::put('/:d_id', 'admin/addons/updateOptions');
            Route::get('', 'admin/addons/index');
            Route::get('install/:d_id', 'admin/addons/install');
            Route::get('uninstall/:d_id', 'admin/addons/uninstall');
            Route::get('toggle/:d_id', 'admin/addons/toggle');//启用或者禁用插件
        });
    });
});
return [

];
